1.5.7 Troubleshooting using scripts
It is not easy to avoid errors in the command syntax when running scripts. This can be misspellings or logical errors that cannot be executed. The system will then stop running the script where the error is located and mark the appropriate line. An error message will also be provided.
What to do:
i. Check what may have gone wrong. Pay special attention to the line marked with errors. Run the part of the script that do not contain errors, i.e. until the line containing the error (see section 1.5.4 on how to run portions of a script)
ii. Double check whether the syntax is correct, that the variable name is correctly spelled, that the date of import is valid (a variable may not have data for the current measurement time)
iii. Use statistical tools like the commands tabulate
or summarize
. See if there are any errors in the way the relevant variables are encoded. Also check if the value format is correct (numerical or alphanumerical)
iv. Dummy variables or categorical variables where at least one of the categories has few observations can lead to undesirable analysis results:
-
When performing regression analyses, only units with valid values across all the included variables will be analyzed
-
Even if all dummy variables to be used in a regression analysis initially have sufficient numbers of observations for both values 0 and 1, this may not be the case if a number of units are kept out of the regression analysis due to missing values
-
The analysis may be stopped and an error message given. A solution can be to recategorize: Recode the variables in question in order to transfer units from the most populated categories into those with the least number of observations. Another solution may be to drop the problematic variables from the analysis